{% extends "profilebase.html" %}

{% block sidebar2 %}
	<h2>Smart Search</h2>
	<small>Try these few tips for a smarter way of searching</small><br/><br/>	

	<b>Multiple Search: Query 1 or Query 2</b><br/>
	<small>e.g. Ahmed or Mohamed Mekky, Electric or Classic Guitar, Sakia or Sakya Culture Wheel</small>
	<br/><br/>
	<b>Exact Search: 'Query'</b><br/>
	<small>e.g. 'Ahmed Mekky'<br/>In this case, only Ahmed Mekky would be found </small>
	<br/><br/>
	<hr/>
	
	{% if not loggedIn %}
		You must <a href="/">login</a> to view be able to view users' accounts
	{% endif %}
		
{% endblock %}

{% block content %}
<h1><a>SEARCH RESULTS</a></h1>

	{% if category == 'all' or category == 'students' %}
		{% if students %}
			<h2>Students</h2>
			{% for student in students %}
				{% if not loggedIn %}
					{{ student.abstract_user }}<br />
				{% else %}
					<a href="/myprofile/{{ student.abstract_user.id }}/">{{ student.abstract_user }}</a><br />
				{% endif %}
			{% endfor %}
		{% endif %}
	{% endif %}
	
	{% if category == 'all' or category == 'teachers' %}
		{% if teachers %}
			<h2>Teachers</h2>
			{% for teacher in teachers %}
				{% if not loggedIn %}
					{{ teacher.abstract_user }}<br />
				{% else %}
					<a href="/myprofile/{{ teacher.abstract_user.id }}/">{{ teacher.abstract_user }}</a><br />
				{% endif %}
			{% endfor %}
		{% endif %}
	{% endif %}
	
	{% if category == 'all' or category == 'institutes' %}
		{% if institutes %}
			<h2>Institutes</h2>
			{% for institute in institutes %}
				{% if not loggedIn %}
					{{ institute.abstract_user }}<br />
				{% else %}
					<a href="/myprofile/{{ institute.abstract_user.id }}/">{{ institute.abstract_user }}</a><br />
				{% endif %}
			{% endfor %}
		{% endif %}
	{% endif %}
	
	{% if category == 'all' or category == 'experience' %}
		{% if t_experience %}
			<h2>Teachers with experience in <i>{{ query }}</i></h2>
			{% for exp in t_experience %}
				{% if not loggedIn %}
					{{ exp.abstract_user }} | Experience: {{ exp.experience }}<br />
				{% else %}
					<a href="/myprofile/{{ exp.abstract_user.id }}/">{{ exp.abstract_user }}</a> | Experience: {{ exp.experience }}<br />
				{% endif %}	
			{% endfor %}
		{% endif %}
	
		{% if s_experience %}
			<h2>Students with experience in <i>{{ query }}</i></h2>
			{% for exp in s_experience %}
				{% if not loggedIn %}
					{{ exp.abstract_user }} | Experience: {{ exp.experience }}<br />
				{% else %}
					<a href="/myprofile/{{ exp.abstract_user.id }}/">{{ exp.abstract_user }}</a> | Experience: {{ exp.experience }}<br />
				{% endif %}
			{% endfor %}
		{% endif %}
	{% endif %}
	
	{% if category ==  'all' or category == 'favourite_genre' %}
		{% if t_favourite_genre %}
			<h2>Teachers with <i>{{ query }}</i> listed in their favourite genre/s</h2><br />
			{% for fav in t_favourite_genre %}
				{% if not loggedIn %}
					{{ fav.abstract_user }} | Favourite genres: {{ fav.favourite_genre }}<br />
				{% else %}
					<a href="/myprofile/{{ fav.abstract_user.id }}/">{{ fav.abstract_user }}</a> | Favourite genres: {{ fav.favourite_genre }}<br />
				{% endif %}
			{% endfor %}
		{% endif %}
		
		{% if s_favourite_genre %}
			<h2>Students with <i>{{ query }}</i> listed in their favourite genre/s</h2><br />
			{% for fav in s_favourite_genre %}
				{% if not loggedIn %}
					{{ fav.abstract_user }} | Favourite genres: {{ fav.favourite_genre }}<br />
				{% else %}
					<a href="/myprofile/{{ fav.abstract_user.id }}/">{{ fav.abstract_user }}</a> | Favourite genres: {{ fav.favourite_genre }}<br />
				{% endif %}
			{% endfor %}
		{% endif %}
	{% endif %}
	
	{% if category == 'all' or category == 'instrument_played' %}
		{% if t_instrument_played %}
			<h2>Teachers who play <i>{{ query }}</i></h2><br />
			{% for ins in t_instrument_played %}
				{% if not loggedIn %}
					{{ ins.abstract_user }} | Instruments played: {{ ins.instrument_played }}<br />
				{% else %}
					<a href="/myprofile/{{ ins.abstract_user.id }}/">{{ ins.abstract_user }}</a> | Instruments played: {{ ins.instrument_played }}<br />
				{% endif %}
			{% endfor %}
		{% endif %}
		
		{% if s_instrument_played %}
			<h2>Students who play <i>{{ query }}</i></h2><br />
			{% for ins in s_instrument_played %}
				{% if not loggedIn %}
					{{ ins.abstract_user }} | Instruments played: {{ ins.instrument_played }}<br />
				{% else %}
					<a href="/myprofile/{{ ins.abstract_user.id }}/">{{ ins.abstract_user }}</a> | Instruments played: {{ ins.instrument_played }}<br />
				{% endif %}
			{% endfor %}
		{% endif %}
	{% endif %}
	
	{% if category == 'all' or category == 'jamming_style' %}
		{% if t_jamming_style %}
			<h2>Teachers who have <i>{{ query }}</i> in their jamming style</h2><br />
			{% for jam in t_jamming_style %}
				{% if not loggedIn %}
					{{ jam.abstract_user }} | Jamming style: {{ jam.jamming_style }}<br />
				{% else %}
					<a href="/myprofile/{{ jam.abstract_user.id }}/">{{ jam.abstract_user }}</a> | Jamming style: {{ jam.jamming_style }}<br />
				{% endif %}
			{% endfor %}
		{% endif %}
		
		 {% if s_jamming_style %}
			<h2>Students who have <i>{{ query }}</i> in their jamming style</h2><br />
			{% for jam in s_jamming_style %}
				{% if not loggedIn %}
					{{ jam.abstract_user }} | Jamming style: {{ jam.jamming_style }}<br />
				{% else %}
					<a href="/myprofile/{{ jam.abstract_user.id }}/">{{ jam.abstract_user }}</a> | Jamming style: {{ jam.jamming_style }}<br />
				{% endif %}
			{% endfor %}
		{% endif %}
	 {% endif %}
	 
	{% if category == 'all' or category == 'teaches' %} 
		{% if teaches %}
			<h2>Teachers who teach <i>{{ query }}</i></h2><br />
			{% for teach in teaches %}
				{% if not loggedIn %}
					{{ teach.abstract_user }} | Teaches: {{ teach.teaches }}<br />
				{% else %}
					<a href="/myprofile/{{ teach.abstract_user.id }}/">{{ teach.abstract_user }}</a> | Teaches: {{ teach.teaches }}<br />
				{% endif %}
			{% endfor %}
		{% endif %}
	{% endif %}
	{% if category == 'all' %} 
		{% if about %}
			<h2>Institutes with <i>{{ query }}</i> in their about section</h2><br />
			{% for ab in about %}
				{% if not loggedIn %}
					{{ ab.abstract_user }} | About: {{ ab.about }}<br />
				{% else %}
					<a href="/myprofile/{{ ab.abstract_user.id }}/">{{ ab.abstract_user }}</a> | About: {{ ab.about }}<br />
				{% endif %}
			{% endfor %}
		{% endif %}
	{% endif %}
	{% if category == 'all' %} 
		{% if contact_info %}
			<h2>Institutes with <i>{{ query }}</i> in their contact information</h2><br />
			{% for ci in contact_info %}
				{% if not loggedIn %}
					{{ ci.abstract_user }} | Contact Info: {{ ci.contact_info }}<br />
				{% else %}
					<a href="/myprofile/{{ ci.abstract_user.id }}/">{{ ci.abstract_user }}</a> | Contact Info: {{ ci.contact_info }}<br />
				{% endif %}
			{% endfor %}
		{% endif %}
	{% endif %}
</br></br></br>
{% if empty %}
	You search returned zero results. Check out the search functionalities available on the right.
	<br/><br/><br/><br/><br/><br/><br/>
{% endif %}
{% endblock %}